/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * @author Brothers
 */
public class Season extends SkiPass {

    private int numberDay;
    final private long MILLDAY = 86400000;

    public Season() {
        this.numberDay = -1;
    }

    @Override
    public boolean isValidDate(Calendar date) {
        Date temp;
        Date tempFirst;
        temp = date.getTime();
        tempFirst = this.getFirstDate().getTime();
        long mill = temp.getTime();
        long millFirst = tempFirst.getTime();
        return mill - millFirst >= this.numberDay * MILLDAY;
        //return date - this.getFirstDate() <= this.numberDay;
    }

    @Override
    public void setNumberDay(int day) {
        this.numberDay = SkiPass.SeasonEnum.values()[day].getEnum();
    }

    @Override
    public int getNumberDay() {
        return this.numberDay;
    }
}
